Skip to content

Bring in upstream LearnHarness 0.7.0 - #322

Merged
max-miller1204 merged 123 commits into
mainfrom
sync/upstream-0.7.0
Nov 22, 2026
Merged

max-miller1204 merged 123 commits into
mainfrom
sync/upstream-0.7.0

Conversation

@max-miller1204

@max-miller1204 max-miller1204 commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

Brings upstream LearnHarness 0.7.0 (amosblomqvist/learnharness@main, 117 commits) into main through a real merge of upstream-main, not a squash or rebase, so later syncs merge cleanly (docs/fork-workflow.md). The standing Sync PR is #320; it closes on its own once main contains upstream.

What changed and why

Upstream PRs included (from #320's body): amosblomqvist#450, amosblomqvist#528, amosblomqvist#591, amosblomqvist#592, amosblomqvist#629, amosblomqvist#632, amosblomqvist#692, amosblomqvist#701, amosblomqvist#725, amosblomqvist#745, amosblomqvist#784 and amosblomqvist#798.

Highlights:

  • shared session folders and the folder Delete in the sidebar, plus a compact session list;
  • figures annotated from the learner's PDFs;
  • plan boxes sized from labels measured in the real font;
  • a per-segment prompt editor;
  • the transcript width setting and adaptive question layout;
  • a remote model catalog with a manual refresh;
  • startup announcements;
  • Next.js 16.4.6;
  • drawing-pad, rich-code-blocks and flashcards fixes;
  • the tightened update-install IPC and CLI environment (fix: tighten update-install IPC, CLI env, and ChatGPT credential reads amosblomqvist/learnharness#592).

The merge conflicted in 22 files. Every fork feature is kept: the T3 update flow parts 1 to 6 and docs/specs/t3-style-updates.md, the desktop server list, the phone app, plugins and auth. Upstream's side is taken everywhere else.

Judgment calls, each one: file, what each side did, what's kept and why.

  1. electron/main.cjs, lh:update-install.

    • Upstream (fix: tighten update-install IPC, CLI env, and ChatGPT credential reads amosblomqvist/learnharness#592): a fire-and-forget ipcMain.on that drops and logs untrusted senders.
    • Fork: an invoke-style ipcMain.handle that answers whether main took the install (the sidebar's Restarting state needs it) and already throws for an untrusted sender, with the same trustedAppWindows and trustedSender rule.
    • Kept: the fork's channel, which already has upstream's hardening.
    • Upstream's new test is ported onto it in tests/automatic-updates.test.ts. It covers a foreign or unregistered window, a missing frame, a navigated or bad URL, and a closed window revoking membership.
  2. electron/main.cjs and preload.cjs, startup announcements.

    • Upstream: electron/startup-messages.cjs attaches to the first window of the launch, waits for its first paint, and gives up on any navigation.
    • Fork: the packaged app's first window can be a remote server window, which has no local bridge, and the local window first shows the ghost dashboard and then navigates to the real page. Upstream's offer would always cancel itself there.
    • Kept: upstream's module, its tests and the StartupMessage mount come in, but stay unwired. There are no preload methods and no IPC handlers, so the component never shows.
    • Wiring it into the server-list launch needs a readiness signal for the real page. That is a follow-up for the owner.
  3. electron/main.cjs, createWindow. The fork's load() and windowLoaders, which install recovery reloads through, are kept. Upstream's beforeLoad(win) hook is called just before the first load, as upstream does.

  4. electron/preload.cjs, components/sidebar.tsx, the preload-surface tests. The fork's bridge is kept: the T3 update methods, no onOpenSettings (removed in Use T3's native update dialogs from the menu in every window #316), no startup-message methods (see 2).

    • The sidebar keeps the fork's bridge types, adds upstream's startup-message types, and mounts both the fork's What's new, update notice and Toaster and upstream's StartupMessage.
  5. The plan layout: src/core/plan-layout.ts, components/plan-layout.ts, components/plan-block.tsx.

    • Both sides moved the layout out of plan-block.tsx. The fork moved it to src/core/plan-layout.ts so the phone draws the same diagram. Upstream moved it to components/plan-layout.ts and changed it to measure labels in the real font (LabelMeasure, chartMeasure, usePlanLayout).
    • Kept: the code lives in src/core/plan-layout.ts, because the phone imports it by path and core must not import components. It is upgraded to upstream's measured layout, with three fork changes:
      • the light dagre-d3-es graphlib subpath import;
      • measure defaulting to chartMeasure for callers that can't measure (the phone);
      • the shared drawing constants (GRAPH_PAD, the glow constants, TEXT_CAP_SCALE, ARROW_HEAD) and latestTree.
    • components/plan-layout.ts re-exports it, so upstream's import path and tests are unchanged.
    • plan-block.tsx is upstream's, importing and re-exporting those shared pieces instead of redefining them.
    • The phone's PlanDiagram now draws the layout's own lines (layout.lines and lineH).
    • The fork's plan golden (tests/plan-diagram-golden.test.tsx) is moved to the new API and recorded again, since upstream's layout change is intended.
  6. components/delete-session-dialog.tsx.

    • The fork's wording comes from the shared DELETE_SESSION_COPY (also the phone's), plus beginSessionDelete.
    • Upstream made the dialog copy-driven so the folder Delete reuses it.
    • Kept: upstream's copy prop, with the session copy built from the fork's shared strings.
  7. src/agent/tools/pdf-figure.ts (new upstream), jobs.ts, subagents/runner.ts.

    • Upstream's PDF figures resolve the path with resolveSourcePath. That can't see the fork's uploaded attachments (attachment:<id>).
    • Kept: both paths now go through the fork's resolveLearnerFile with the chat's attachment lookup, as images already do. Only the opaque reference is shown, and attachment errors use learnerFileErrorMessage.
    • The dispatch gate keeps upstream's "image or pdf, not both".
  8. src/agent/tools/learner-image.ts. The fork's attachment-aware read and its error messages are kept, and the result goes through upstream's new learnerImageFromBytes, which PDF figures share.

  9. src/agent/subagents/pdf-reader.ts. The fork's attachment resolution, with upstream's removal of the 14-turn cap (maxIterations optional; upstream c7dd027, "remove implicit background-agent turn caps").

  10. instrumentation.ts. Both: the fork's data lock and attachment sweep, then upstream's model catalog initialization.

  11. src/server/source-deletion.ts, components/delete-session-dialog.tsx, components/sidebar.tsx, upstream's folder Delete (completed in rounds 1 and 2).

    • It now schedules each session's attachment removal, as the fork's session and source deletes do (docs/specs/remote-safe-attachments.md).
    • It now keeps the fork's "delete while viewing" rules (docs/specs/polish-first-load.md item 4). Each session's reads are held while the request is in flight, and an open session that went is dropped and left with router.replace("/") (the new leaveDeletedSession).
    • The session's stats read (readStats, ?view=stats) holds too, like the record and stream reads. The merge had moved it off the held path.
    • A Delete that fails partway reports the sessions already removed (checked against what's left), so their reads stay held and the sidebar leaves the open one if it went.
  12. package.json and package-lock.json.

    • Upstream's Next.js 16.4.6 is taken. The fork's @earendil-works/pi-schema 1.5.2 dependency is kept.
    • The lock is regenerated with npm install from upstream's lock and the merged package.json.
    • The plugin .sdk/package.json files regenerate with no change, and no plugin package.json changed.
  13. src/agent/models.ts, Anthropic message threads (owner decision, 2026-11-21).

    • Upstream turned Pi's message threads off for direct Anthropic auth, because Pi's thread identity doesn't include a credential resolved per request.
    • The owner keeps threads on (Upgrade Pi to 1.5.2 #278).
    • Done: upstream's switch-off is reverted, and its real bug is fixed. The session id Pi keys a thread by now carries a hash of the credential that request sends (anthropicThreadSession), so the same key continues its thread and a rotated key starts a new one.
    • The credential is resolved once (Pi's own models.getAuth()), and that exact key and those credential headers are what the request sends. A rotation or OAuth refresh between the fingerprint and the send can't put another key on the thread, and a per-request x-api-key override is part of the fingerprint (round 2).
    • tests/provider-neutral-agents.test.ts checks:
      • create, a fresh create after the rotation, then continue;
      • a rotation landing between the fingerprint and the send;
      • a header override;
      • a unit test of the hash.
  14. Tests that pin behaviour both sides touched.

    • tests/openrouter-free-models.test.ts: the fork's "is no longer available" wording, and the fork's priced retired models (src/server/retired-models.ts keeps openai/gpt-3.5-turbo's price for usage already spent, though it never runs).
    • Upstream's new model refresh can list a model Pi's bundled catalog dropped. Since round 2 it imports it like any other id: pi.dev lists it because the provider serves it (huggingface:zai-org/GLM-4.5 and openrouter:meta-llama/llama-3.1-70b-instruct are live), so a saved session on it runs again.
    • Pricing is catalog-first, with the retirement table only when no catalog has the id, as before the merge. An id the feed doesn't list stays unrunnable at its recorded price. Freezing historical prices per call is Usage history is repriced when a model's catalog price changes #332.
    • jobs, extraction and session-identity: upstream's newer usage and route assertions for Pi 1.5.2.
    • side-chat: both sides' new tests.
    • Comment-only conflicts in auth-keys.ts and plugin-background-tools.ts: upstream's wording.
  15. The client protocol guard (tests/client-protocol.test.ts).

    • Upstream's lettered options add an optional optionOrder to QuestionData and QuestionAnswerData (src/core/question-core.ts), and shorten some model-facing descriptions.
    • That is additive: an older phone ignores it. Under the guard's own rule that means a capability, not a version bump.
    • Done: a new question-option-order-v1 in serverInfo(), src/client-protocol/index.ts and docs/specs/client-protocol.md, with the fingerprint recorded again.
  16. Import cycles through the settings dialog and the sidebar (verify round).

    • The merge added a runtime cycle: upstream's per-segment prompt editor in Settings (agent-section → prompt-segment-dialog → prompt-text → host-markdown) reaches the chat, which reaches the sidebar, which mounts Settings.
    • Through the plugin host's async modules, the production bundle rendered SettingsDialogProvider before its module had initialized, so the first signed-in page returned 500.
    • Upstream 069a6a1 has the same edges and serves 200. Main lacks the prompt editor.
    • Fix: small modules hold what the cycle needed:
      • settings-dialog-context.ts: useSettingsDialog;
      • sidebar-toggle.tsx: SidebarToggle and useSidebar;
      • time-ago.ts: timeAgo.
    • The settings dialog and the sidebar are on no import cycle (tests/import-cycles.test.ts), and both re-export what moved.
  17. components/sidebar-folders.tsx, the root drop space (verify round). Upstream's aria-label on a plain div is prohibited by ARIA (axe aria-prohibited-attr, serious, also on upstream), so SidebarRootDrop has no name. Moving out of folders from the keyboard isn't in the sidebar on either side, and is left for later.

Verified

CI was red at 48dc216. All three Standalone jobs failed in upstream's new scripts/smoke-plan-labels.mjs. It polled GET /api/chats signed out, and the fork has no localhost bypass (proxy.ts), so it got 401 until it timed out.

  • Since round 1 it signs in the way scripts/smoke-server.mjs does: a session in the server's own store, used as the poll's bearer and the browser's cookie.

  • Run locally against npm run build with Chrome, it passes all 79 checks.

  • npx tsc --noEmit, npm run lint (no errors, one existing warning) and node --test .github/scripts/*.test.cjs (50) pass.

  • The 70 test files touching every conflicted area pass, one at a time under a memory cap: the eight conflicted test files, plus every test importing the desktop updater, preload, sidebar, plan, delete dialog, startup message, PDF reader, jobs, learner image, PDF figure, auth keys, plugin background tools, source deletion or instrumentation code.

  • The full root suite (468 files, 10 shards, two files at a time under a 3.5 GiB cap): 6,232 passing, 1 failing, 1 timed out.

    • The failure was the client-protocol guard (item 15). After the fix, tests/client-protocol.test.ts (15) passes when run alone.
    • The timeout is tests/claude-code-tool-bridge.test.ts "binds 127.0.0.1", which times out on this machine. It connects to the machine's first external IPv4 and expects a refusal. Here that's a Tailscale address (100.x), which drops the connection instead of refusing it. The bridge and its test are unchanged by this merge.
  • node --test selfhost/tests/*.test.ts: 112 passing.

  • The phone app (apps/mobile, which the plan layout change touches): npm ci, npm run typecheck, npm run lint and npm test (154) pass. deps:check was not run (the app's package.json is unchanged).

  • Not driven in the real app.

Source

Upstream amosblomqvist/learnharness 0.7.0 (gh release view v0.7.0 -R amosblomqvist/learnharness), through upstream-main. The Sync PR is #320.

IsaacZhangg and others added 30 commits November 4, 2026 21:17
The teacher can now annotate a figure that lives inside one of the
learner's PDFs (a diagram on a lecture slide, a plot in a paper) without
the learner screenshotting it first.

- visual gains an optional `pdf: { path, page }` beside `image` (never
  both). Dispatch checks the path against File access, that pdfjs opens
  the file, and that the page exists; a bad PDF or page fails the call
  before any job exists.
- At job start the page is re-checked and rendered natively (~1600px).
  The visual-maker sees the page and calls a new PDF-only `crop_page`
  tool with a box in page-image pixels. The crop is re-rendered from the
  PDF (fitLongSide 1600, at most 300 dpi), shown back, and becomes the
  picture it annotates through the existing placeholder pipeline.
  Re-cropping discards the SVG; a figure that fills the page may be
  annotated whole; a figure that is not on the page fails with notes.
- Only the final crop is stored as a session snapshot. VisualResult.image
  records the page and crop (page fractions) for provenance.
- renderPdfPages takes an optional crop and fitLongSide; existing callers
  are unchanged. learner-image.ts exports learnerImageFromBytes so PDF
  renders share the photo normalization and snapshot identity.
- Teacher prompt 55-images.md, README and docs updated.
Lockfile-only npm audit fix (zod, puppeteer-core/chromium-bidi,
dompurify, undici, fast-uri, source-map-js and their trees), resolved
with a 14-day release cooldown (--before=2026-10-24). Remove the unused
ansi-to-react (the only path to vulnerable linkify-it) and
react-jsx-parser; neither is imported anywhere.
- lh:update-install now uses the same trusted-window/main-frame sender
  check as lh:update:get and lh:update:check; untrusted requests are
  dropped and logged.
- externalCliEnv strips LH_DESKTOP_API_SECRET and LH_DESKTOP_SERVER, as
  the browser-service helper's spawn env already does.
- The ChatGPT credential reader refuses symlinks and, outside Windows,
  files readable by group/other or owned by another user, matching
  subscription-store.cjs.
…notation-agent-cfdc72

# Conflicts:
#	src/agent/subagents/visual-maker.ts
# Conflicts:
#	package-lock.json
#	package.json
Side questions on OpenCode Go fail before any token is used:

  400 {"type":"MissingSessionID","message":"Request is missing
  x-opencode-session and cannot be routed efficiently."}

pi-ai adds that header only when the request carries a session id, and
streamSideAnswer deliberately left it out to keep Claude Code from
resuming the lesson's live CLI process. That reason only applies to
Claude Code: every HTTP provider now gets the chat id, so OpenCode Go can
route the side question and keep its prompt cache warm.

Regression coverage lives in tests/session-identity.test.ts: both
OpenCode Go transports carry x-opencode-session, and a Claude Code side
question still sends no session id.
The unit test covers the stream options; this one drives the real side-chat
service and records what reaches the engine, so a future refactor that drops
the chat id from streamSideAnswer fails here instead of at the provider.
React's development server renderer seals each useRef object
(Object.seal). Chat assigned `changed` onto one ref after creating it,
and DockOverlay assigned it onto three more, so every chat page threw
"Cannot add property changed, object is not extensible" under next dev.
Production builds skip the seal, which hid the bug.

The readers are now plain objects made once with useState, with
`changed` included from the start. DockOverlay's readers forward
`changed` to the latest parent reader, the same callback the old
per-render assignment set.

tests/chat-dev-render.test.tsx renders the chat with React's development
server renderer. It failed with the same error before this change.
plan-block.tsx held three things in 984 lines: layout math, edge
geometry and three React views. The layout math (character-class
width estimate, 28-letter wrap, dagre placement, edge paths) now
lives in components/plan-layout.ts, unchanged. HEAD_H and HEAD_W
become exports so the arrow markers keep using them.

No behavior change. The existing plan tests pass with only their
import paths changed.
Plan boxes got their width from one per-letter chart fitted to Source
Sans 3, and lines broke after 28 letters, while the labels drew in
whatever reading font Appearance picked. JetBrains Mono labels came out
40-55% wider than the chart said: 13 of 14 boxes in the test session
spilled past their borders, and side-by-side labels ran into each other.
Chinese and Japanese titles spilled with the default font too.

blockLayout() now takes the measurer as its third argument. The
measurer answers line breaks, line widths and font size, and
usePlanLayout() asks the browser for all three, inside the diagram's
own svg:

- Line breaks: one hidden HTML block, capped at 12.75 em, where the
  browser breaks each title by its own Unicode rules. Words never split
  and never hyphenate; any word wider than the cap widens its box.
  Korean titles use word-break: keep-all, since Korean separates words
  with spaces.
- Widths: one hidden SVG <text> at the heaviest weight any label uses.

Line height and vertical centering come from the measured font size.

The server and the first client render still lay out with the old
chart, now only as stand-in measurer that wraps at spaces, so server
HTML and hydration match. One ResizeObserver on fixed sample text
re-measures when the label font changes size: web font loads, font
picks in Settings, size changes.

The popup now computes its layout once and shares it with the diagram.
Unit tests feed fake widths and line breaks to the layout, so only real
browsers catch labels spilling out of their boxes or lines breaking in
the wrong places. scripts/smoke-plan-labels.mjs runs next start on the
production build with throwaway copies of the test data, plus two seeded
chats: one whose 14-node plan has hard titles (Chinese, Japanese,
Korean, Arabic, emoji, long words, wide capitals) and one that ends on
one unanswered question, so the dock shows the plan beside it.

For every label line it checks rendered width <= box width minus 16px
padding per side, and that the text stays inside the box vertically.
Per node it checks that the lines keep the whole title, split no word
and start no line with closing punctuation. It covers 8 fonts x 4 label
sizes on both plans, the popup, the dock plan, one live Settings switch
to JetBrains Mono with no reload, and cold loads in that font with zero
hydration errors. The app has no label size setting, so the script
forces sizes with one injected CSS rule and checks they applied.

CI runs it in the standalone job right after npm run build, on macOS,
Windows and Linux.

On this branch: 74 of 74 checks pass. On cb25c8e (before the fix):
64 of 74 fail.
wrapRegionLabel() split words too long for one line by single UTF-16
units, and trimmed its ellipsis the same way, so emoji broke into
halves. wrapLabel() split node labels by code point, which cuts flags
and ZWJ sequences. On the graph home, one session named with emoji
showed its family emoji split across two lines, and on Windows one node
label made of flags broke "CA" into "C" and "A".

Both now split between graphemes (Intl.Segmenter): emoji, flags and
accented letters stay whole. Nothing else about wrapping changes.

The new wrapRegionLabel test failed on the old code: its lines held
lone surrogate halves.
The in-chat plan and the dock plan scale up to fill their column,
capped by TEXT_CAP_SCALE = 16 / 12.5 so labels never grow past the 16px
prose size. That ratio assumed 12.5px labels, but --text-xs is 11px, so
the cap stopped labels at 14.08px. It also ignored the reading size
picked in Settings.

PlanDiagram now takes textCap, the largest on-screen label size in px,
and divides it by the label size the layout measured. Both callers pass
Appearance's proseFontSize. On one 2-node test plan, labels now reach
16px at the default reading size and 20px at reading size 20 (14.08px
both times before).
The stop button was centered on the whole card, so expanding a card
moved it down onto the Cost row. Position it against the face row only.

The expanded view no longer repeats the title the face already shows.
It keeps the activity line, which wraps there instead of being cut off.
The face title gets a title= tooltip like the activity line, so a long
title stays readable.

Fixes amosblomqvist#450.
visibleStrokes replayed the whole eraser history, segment by segment, on
every call (three times per pen lift plus every repaint). It is now:

- memoised per history array (WeakMap, keyed by identity);
- incremental when the history is the previous one plus one stroke: a pen
  stroke appends, an eraser filters the previous result and returns the
  same array object when it touches nothing;
- prefiltered per pen/eraser pair by bounding boxes (pen bounds incl. each
  segment's half width, cached per committed stroke; eraser raw point
  bounds, never cached), inflated by the 12px contact radius, so only true
  misses are rejected and results are identical.

Also adds strokeBounds/liveBounds and visibleUnderEraser (live eraser,
never cached). The return type becomes readonly Stroke[]; no caller
mutates it.

Until the sheet stops doing so (repaint work), render still resolves
[...draft.strokes, active]. That stays correct: eraser bounds are never
cached, and the active pen is always the last entry, so its bounds are
never measured while it grows.

Tests: an oracle copy of the previous resolver checked against 200 seeded
random histories (fresh, built one stroke at a time, undo, repeated), the
13/14px boundary diagonally and at full pressure, identity of no-op eraser
results, live erasers against 100 random cases, bounds, and that the input
array is never returned.
…tion

Every Sheets publish called ctx.refreshActions() and refreshSubmissions()
(two host re-renders) and the Draw label/hasPendingInput then serialised
every visible point with JSON.stringify. This fired per stroke, per tool
change and per pan pointermove.

- inkSignature identifies visible strokes by a per-stroke id
  instead of their points. Committed strokes are never mutated or rebuilt,
  so draw-then-undo still matches; an erased stroke redrawn with identical
  coordinates now counts as changed.
- Sheets.publish takes a reason ("sheet" | "ink" | "camera" | "tool");
  the constructor callback and onChange listeners receive it.
- The host callback ignores camera/tool changes and refreshes the host only
  when what it reads changes: per session pending, has draft, has strokes,
  and seenPoses.size (hasPendingInput checks seenPoses for practice problem
  targets, and a backfilled pose can be recorded without a publish; the
  size term lets it reach the host with the next stroke, as before). The stale-palette check runs on "sheet" changes only.

Host reads were audited: action.name and hasPendingInput are read on host
render; the undo/toggle/hand predicates are evaluated at invocation only.

Tests: publish reasons, pending/signature semantics (undo to the sent
drawing, missed eraser, color change), and frontend refresh counts with
the real Sheets (first stroke 1, strokes 2-20 0, pans and tool switches 0,
undo to empty 1; practice send/next stroke/undo-to-sent 1 each; a silent
pose backfill reaches the host with the next stroke).
Pen down and pen lift each repainted the whole sheet (twice on lift), the
eraser repainted on every pointermove, and every pan move repainted
synchronously. The sheet now tracks what the canvas shows and brings it
up to date with the least painting:

- render() is split into renderChrome() (toolbar, buttons, cursor,
  status; button props are memoised per handle), layout() (reference
  image, bitmap size) and syncInk(). render() still runs all three.
- syncInk() compares the target (visible committed strokes, minus any
  under a live eraser) with what was painted for this draft, color, origin
  and bitmap size: nothing when equal, only appended strokes when the
  target extends it (the just-committed live stroke is already drawn),
  otherwise one full repaint that re-strokes a live pen stroke on top.
  Same paintSegment calls, order and transform as a full repaint.
- Pen down paints its first dot directly; a mouse pointerup paints the
  final segment it adds; the commit then draws nothing.
- Eraser and pan moves schedule at most one layout + ink sync per
  animation frame (reference image and ink move in the same frame).
  Discrete events (pointerup, undo, clear, tool change, sheet changes,
  resize, dispose) apply a pending frame synchronously.
- Pointer geometry is measured once per gesture (and after layout or pan
  changes); the 2D context is obtained once (attributes unchanged here).
- Full repaints skip strokes whose bounds lie outside the viewport; export
  never culls. paintStrokes() takes resolved strokes; paintInk() keeps its
  signature for capture.ts.

Tests: new browser groups count full repaints via clearRect: 20 pen
strokes, a pressure-varying pen stroke and a dot cause none and equal a
forced full repaint pixel for pixel; eraser sweeps repaint nothing over
empty space and at most once per frame across ink; a 60-move pan repaints
at most once per frame with ink and reference at the same offset after
every frame; Undo, theme change, resize and Clear equal a full repaint;
culled ink returns exactly and is still exported.

Changed wait in an existing test: "zero-pressure hover and held/released
stylus eraser" now awaits one animation frame after the held-eraser
pointermove before reading the canvas (live eraser previews repaint per
frame).
Pressing and holding the eraser over a stroke left the stroke visible
until the eraser moved or lifted. start() synced the canvas before it
created the eraser stroke and then painted only pen input. It now syncs
the ink after it creates an eraser stroke, as render() did before.

Test: a browser group holds the eraser still over a fresh stroke and
expects it gone after two animation frames, still gone on release, and
restored then removed by two Undos.
Brings upstream main at 0.7.0 (117 commits) with a real merge, so later
syncs merge cleanly. Conflicts resolved to keep every fork feature (the
T3 update flow, the desktop server list, the phone app, plugins, auth)
and take upstream elsewhere; where both changed the same behaviour, the
fork's is kept with upstream's intent folded in:

- electron: the fork's invoke-style lh:update-install keeps its sender
  check (upstream's hardening intent is already there); upstream's test
  of it is ported to that channel. Upstream's startup announcement module
  comes in unwired (the fork's local window first shows the ghost page).
- plan layout: the shared layout stays in src/core/plan-layout.ts for the
  phone, upgraded to upstream's measured labels; components/plan-layout.ts
  re-exports it; the plan golden is recorded again.
- PDF figures: upstream's new pdf-figure.ts resolves paths through the
  fork's learner-file, so uploaded attachments work there too.
- package-lock.json regenerated with npm install (Next.js 16.4.6).
- client protocol: upstream's optional question optionOrder is additive,
  so it gets a capability (question-option-order-v1), no version bump.
- Anthropic message threads stay off for direct auth (upstream's fix);
  the fork's test that expected them is updated.

Verified: checks
@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Preview ready for a216139c59c2 (0.7.0-preview.20261122.255). On your server:

lh preview 322

It runs beside your server on port 3775 with fresh, empty data, and Ctrl+C stops it and deletes it. Release files. Each push builds a new one.

…etired models

- smoke-plan-labels signs in with a session in the server's own store
  (no localhost bypass), as smoke-server does.
- A folder Delete removes its sessions' uploads, holds each session's
  reads while in flight, and leaves an open deleted session with a
  replace after dropping its view.
- Anthropic message threads stay on for direct auth; the thread's
  session id carries a hash of the credential, so a rotated key starts
  a new thread.
- A model refresh never imports a retired model, and pricing reads the
  retirement table first.

Verified: checks
@max-miller1204

Copy link
Copy Markdown
Owner Author

Round 1 fixes (eab07a2)

Each fix has a test that fails on 48dc216 (checked by swapping the old files back) and passes now, except the CI smoke, which has no unit test.

Important

  1. CI's three Standalone jobs (scripts/smoke-plan-labels.mjs)
    • Cause: upstream's smoke polled GET /api/chats signed out, and the fork has no localhost bypass, so it got 401 until timeout.
    • Fix: it now writes a session into the server's own store with issueSession, as scripts/smoke-server.mjs does. That session is the readiness poll's bearer and the browser's lh_session_<port> cookie, with PORT set so the server names the cookie the same way.
    • Local check: against a local npm run build with Chrome, the smoke passes all 79 checks.
  2. Folder Delete and uploads (src/server/source-deletion.ts)
    • Fix: deleteFolderWithSessions now schedules each session's attachment removal before the deletes, as deleteSources does.
    • Test: "a folder Delete removes its sessions' uploads too" in tests/remote-attachments.test.ts. The deleted session's upload is collected, and another session's stays.
  3. Deleting the folder of the open session
    • Dialog: the folder dialog's run() marks every scope.chatIds with beginSessionDelete before the request. It settles each with whether it was deleted, or all false on a refusal or a network error. An unreadable body never undoes a confirmed delete.
    • Sidebar: onFolderDeleted now uses the new leaveDeletedSession in components/session-deletion.ts. That drops the view first (onViewedSessionDeleted), then calls router.replace("/") instead of push.
    • Tests: tests/folder-delete-viewing.test.tsx covers reads held in flight and kept held once deleted, a refusal releasing them, and drop-then-replace.
  4. Anthropic message threads on, per key (src/agent/models.ts)
    • Change: upstream's switch-off is reverted. For direct Anthropic auth, the session id Pi keys a thread by now carries anthropicThreadSession(chatId, auth), a 16-hex SHA-256 of the credential that request uses. That credential comes from Pi's own models.getAuth(), the same resolution its request uses.
    • Effect: the same key continues its thread, and a rotated key starts a new one. The key itself never appears.
    • Tests (tests/provider-neutral-agents.test.ts): the suite rotates the key after round 0, so round 0 creates, round 1 creates a fresh thread for the new key, and round 2 continues it. A unit test covers the fixed key, the rotated key and header auth, and checks the key never appears.
    • The teacher-agent.ts comment now says threads continue with the same key.
  5. Retired models stay retired
    • Importer: checkedModels in src/server/remote-model-catalog.ts skips any id in RETIRED_MODELS. That covers both a refresh and an offline restore.
    • Pricing: src/server/pricing.ts reads the retirement table before the catalog.
    • Test (tests/remote-model-catalog.test.ts): a feed row for openrouter:openai/gpt-3.5-turbo is not imported, the model still fails as "is no longer available", and history stays at $2, also with a catalog overlay that lists the id at $7.

Nit

  • Tightened assertions: every untrusted sender case in the ported update-install test now requires the "Untrusted desktop request" error, { sender: {} } included (it throws that error too), and so does the navigated-URL loop.

PR body: says CI was red at 48dc216 and why. It updates judgment calls 11 (the folder Delete) and 13 (threads), and adds the retired-model refresh to call 14.

Checks

  • tsc is clean, and ESLint reports no errors.
  • Each test file passed when run alone under the memory cap:
    • automatic-updates (71)
    • provider-neutral-agents (36)
    • remote-model-catalog (3)
    • remote-attachments (15)
    • folder-delete-viewing (3)
    • openrouter-free-models (5)
    • folder-deletion-route (7)
    • source-deletion-route (11)
    • source-deletion-ui (9)
    • render-sidebar (16)
    • render-sidebar-folders (4)
    • client-protocol (15)
    • session-core (108)
    • side-chat (28)
    • cache-retention (10)
    • pricing-native-parity (4)
    • cost-summary (4)
    • and the other pricing and auth suites

… models

- Anthropic threads: the credential is resolved once and that exact key
  and those credential headers are what the request sends, so a key
  rotated or refreshed between the fingerprint and the send can't land on
  the old key's thread. The fingerprint covers a per-request x-api-key
  (or other credential header) override.
- Session stats read: readStats holds while this window deletes the
  session, like the record and stream reads, so a turn ending during a
  single or folder Delete no longer 404s on ?view=stats.
- Retired models: a pi.dev refresh imports any id the feed lists, so a
  model the provider still serves runs again. Pricing is catalog-first,
  with the retirement table only when no catalog has the id (the fork's
  design before the merge). Comments say what is true now.
- Folder Delete that fails partway: the server re-checks which session
  records are gone and reports them, the dialog keeps their reads held,
  and the sidebar leaves the open session if it went.
- session-deletion.ts: each doc comment sits above its own function.

Verified: checks
@max-miller1204

Copy link
Copy Markdown
Owner Author

Round 2 fixes (31e28af)

Each fix has a test that fails on eab07a2 (checked by swapping eab07a2's files back) and passes now.

Important

  1. The thread fingerprint and the credential sent (src/agent/models.ts)
    • Fix: the wrapper resolves the credential once (Pi's models.getAuth()) and passes that exact apiKey and headers into the stream call.
      • With the key given, Pi's second resolution inside the request takes it as is, with no env read and no OAuth refresh.
      • A transformHeaders drops any credential header that resolution added.
      • The fingerprint (anthropicThreadSession(chatId, apiKey, credentialHeaders)) covers the key plus authorization, x-api-key and cf-aig-authorization from the merged headers, so a per-request x-api-key override counts. Header names are compared case-insensitively.
    • Tests (tests/provider-neutral-agents.test.ts):
      • "a key rotated between the fingerprint and the send never reaches the old key's thread" rotates the key right after the wrapper's resolution for request 1.
        • Now: create (first key), continue (first key), create (rotated key).
        • On eab07a2, request 1 sent the rotated key on a continue of the first key's thread, Codex's repro.
      • "a per-request x-api-key override is the credential the thread belongs to".
        • Now: override one creates, override two creates its own thread, then continues it.
        • On eab07a2, override two continued override one's thread.
      • The unit test also covers a header override and case-insensitive names.
  2. The stats read and the delete hold (components/session-core.ts)
    • Fix: readStats now awaits sessionReadHold(chatId) before its ?view=stats fetch, as fetchView does. That covers the single and the folder Delete.
    • Test (tests/session-core.test.ts): "a usage-only read holds while this window deletes the session, like the record reads". A deleted session's stats read never fetches, and a refused one runs after the refusal.
  3. Retired models that pi.dev still serves
    • Importer: checkedModels no longer skips RETIRED_MODELS ids, so a listed id is imported and runs again.
    • Pricing: catalogModel is catalog-first again, with the retirement table only when no catalog has the id (the fork's pre-merge design).
    • Context limits: catalogContextLimits was already catalog-first.
    • Test (tests/remote-model-catalog.test.ts):
      • With the feed listing openrouter:openai/gpt-3.5-turbo, that id is imported, piEngineForSpec runs it, and it's priced from the feed ($7).
      • The unlisted openai/gpt-3.5-turbo:batch still fails as "is no longer available", at the table's $1.
      • Freezing historical prices per call is Usage history is repriced when a model's catalog price changes #332, left alone.

Nits

  • Comments: retired-models.ts and the checkedModels comment now say the table only prices ids no catalog has, never makes a model runnable, and that a listed id is served again.
  • JSDoc: sessionReadHold's doc is back above sessionReadHold, and leaveDeletedSession follows with its own.
  • Partial folder Delete:
    • Server: on any failure in the record loop, deleteFolderWithSessions re-checks which session records are actually gone and puts them on the error (deletedChatIds). The route returns them with the error.
    • Dialog: it settles those as deleted (their reads stay held) and calls the new onPartlyDeleted.
    • Sidebar: it drops them from the list and leaves the open session with leaveDeletedSession if it went.
    • Tests:
      • tests/folder-deletion-route.test.ts "a Delete that fails partway names the sessions it already removed" (the store swallows the second unlink, giving a 500 naming the one removed).
      • tests/folder-delete-viewing.test.tsx "a Delete that failed partway keeps the removed sessions' reads held and reports them".

PR body: judgment call 11 adds the stats hold and the partial Delete, 13 the single credential resolution and header override, and 14 the refresh importing listed ids with catalog-first pricing.

Checks

  • tsc: no errors in this change. One remaining error, tests/plugin-submission-frontend.test.ts(82,11) TS2540, also appears at eab07a2 with this machine's install (CI's Typecheck passed there). It isn't from this round.
  • Lint: ESLint reports no errors (one existing warning).
  • Tests: each file passed when run alone under the memory cap:
    • provider-neutral-agents (38)
    • session-core (109)
    • remote-model-catalog (3)
    • folder-deletion-route (8)
    • folder-delete-viewing (4)
    • openrouter-free-models (5)
    • remote-attachments (15)
    • source-deletion-route (11)
    • source-deletion-ui (9)
    • render-sidebar (16)
    • render-sidebar-folders (4)
    • pricing-native-parity (4)
    • pricing-transport (2)
    • cost-summary (4)
    • graph-pricing (4)
    • usage (9)
    • extraction (89)
    • custom-provider-lifecycle (10)
    • cache-retention (10)
    • client-protocol (15)
    • model-catalog (27)
    • session-identity (35)
    • and the subscription, ChatGPT stream and plugin-submission-native suites

Brings main's phone math fix (#318, apps/mobile only) into the 0.7.0
sync. No conflicts.

Verified: checks
@max-miller1204

Copy link
Copy Markdown
Owner Author

prove-learnharness: BROKEN for 83ca438

Two regressions reproduced against main. The first signed-in visit to /chat/new returns 500 on the PR and 200 on main. Axe also reports a serious invalid ARIA label on the sidebar root drop target.

Couldn't prove the native older phone, full paired-desktop update flow, automatic self-hosted download, or a clean local pass of the upstream plan-label smoke. The receipt records the narrower checks and their results.

Observations

Flow Result Observation
Cold signed-in visit to /chat/new FAIL The PR returned 500 on the first visit in repeated fresh standalone instances and 200 on the second. Main returned 200 on both. The PR server logged ReferenceError: Cannot access 'R' before initialization. See supplemental/cold-start-and-axe/.
Accessibility budget FAIL Axe reported serious aria-prohibited-attr on the PR's sidebar-root-drop: a generic div has aria-label="Move outside folders". Main had zero such violations. This recurred on the new, question, and reloaded transcript pages.
Shared sidebar folders and graph filter PASS Teaching and practice appeared under one folder on both builds. Selecting a sidebar folder in the graph hid an out-of-folder node that the graph search had found.
Compact list and transcript width PASS On both builds a sample row went from about 55 px to 32 px, and the width changed from Full to 46 rem and survived reload.
Side-by-side questions and letters PASS Both builds placed the same tall question in columns at 1720 px and stacked it at 840 px. Single-select options had A/B labels.
Agent prompt editor PASS The same 6,196-character default was readable on both builds. A saved, active override survived reload on both.
Model catalog refresh PASS with mock Settings issued the refresh and displayed the same no-provider result with the clean configuration. The PR's running server then imported a model from a mocked provider feed and used it in a real session.
Plan label smoke Shared failure Local PR and upstream each ran 79 checks and failed the same JetBrains Mono 11 px hard-title case. The Korean label measured 145.2 px in a 167 px box with 16 px padding per side. PR Linux CI reported a pass. Local evidence is in both plan-label result files.
Drawing Pad and plugins PASS Enabling the core plugin, drawing a stroke, and undoing it worked on PR, main, and upstream. The TeX check also exercised the core plugin settings.
Attached PDF crop PASS The PR accepted a PDF through the browser file chooser. The mock model dispatched visual, cropped page 2, annotated the 248 × 186 px image, and produced a visible artifact with job status done. Upstream produced the matching artifact using its local-file attachment path.
TeX code block PASS With Rich code blocks and Technical diagrams on, both builds displayed an undefined-control-sequence diagnostic and the original bad line.
Folder Delete PASS The PR left the viewed session, Back stayed outside it, and the claimed upload count fell from 1 to 0. Back reopened the deleted session on upstream.
Desktop updates and server list PASS for local paths driven Packaged PR and main matched for the local Settings button, download pill, hover notes, failed-download toast and Switch server picker. The real Check for Updates menu handler supplied the same Download/Later dialog for the fake update, with the expected installed version. The dialog arguments were captured through the main-process inspector.
Startup announcements PASS The packaged PR showed no announcement or announcement preload methods on startup.
Sign-in and pairing PASS In clean browser contexts both builds accepted the one-time code and allowed a session read (200). Reusing the code returned 401 and left the browser signed out.
Phone protocol PASS for wire compatibility The same protocol-1 client paired, created, read, and streamed sessions on both builds. Token exchange returned 200 and reuse 400. The PR advertised question-option-order-v1; main did not advertise it.
Teaching and scripted probes PASS for behavior With the supplemental selector reading the option label, both reads were byte-for-byte correct, the answer reached the model, the transcript persisted, and deletion and list ordering matched main. Packaged Electron completed the teaching flow. Broken stream recovery, double submit, mouse and keyboard Retry, and clean API checks matched main.
Standard scripted plan FAIL The maintained script read ABlue or BBlue as the option label and timed out without choosing Blue. That left downstream observations empty and disturbed the first API snapshot. Unchanged API scripts on fresh instances matched. The letter-aware browser drive still failed the accessibility budget. Self-hosted tier A matched main. After a clean mobile dependency retry, 158 unit tests and five link checks passed.
Self-hosted update and rollback PASS via explicit CLI Original tier B stopped at the update being available. A separate run using lh update --now installed B, backed up A, rejected broken C, rolled back to A, and kept the session through each switch. The real service and install fingerprint matched before and after.
Anthropic threads PASS with mock The PR sent create, continue, create, continue across two turns per key. Main sent create, continue, continue, continue across the same rotation. Four replies persisted on each build. No raw synthetic keys appeared in the app logs.
Retired models PASS with mock The listed retired model went from rejected to selectable and ran at the feed price of $2 input and $5 output per million tokens. The unlisted retired ID stayed absent and was rejected. The focused pricing test retained its $1 per million input/output pair from the historical table.
Verification receipt

Receipt for PR #322

Verdict: BROKEN
Checker: independent test sub-agent
Scope: 09b53a6371ffb7d3648a57d324674754a99409c5 to 83ca4387780769c75eb6ce4c6910e09e9ad4dc55. Clean checkout at scope calculation.
Changed files: 230, listed in scope.txt.
Surfaces driven: standalone web, HTTP API, agent tools, packaged Linux Electron under Xvfb, disposable lh server, and protocol 1.
Instances: head 0.7.0-nightly.20000101.2 and main 0.6.1-nightly.20000101.1 on throwaway ports and data. The supplemental browser checks used the checksum-verified PR CI bundle and upstream's Linux 0.7.0 bundle. The upstream release tag and 069a6a11 have identical runtime source for the tested surfaces.

Answer keys

  • New upstream features used upstream 069a6a11 and the 0.7.0 release notes.
  • Existing fork behavior used origin/main. The desktop update checks also used parts 1 to 6 of docs/specs/t3-style-updates.md.
  • Folder deletion used upstream's folder flow and the fork's existing open-session deletion behavior. The owner's decisions governed startup announcements, credential-scoped Anthropic threads, and retired model pricing.

Observations

Flow Result Observation
Cold signed-in visit to /chat/new FAIL The PR returned 500 on the first visit in repeated fresh standalone instances and 200 on the second. Main returned 200 on both. The PR server logged ReferenceError: Cannot access 'R' before initialization. See supplemental/cold-start-and-axe/.
Accessibility budget FAIL Axe reported serious aria-prohibited-attr on the PR's sidebar-root-drop: a generic div has aria-label="Move outside folders". Main had zero such violations. This recurred on the new, question, and reloaded transcript pages.
Shared sidebar folders and graph filter PASS Teaching and practice appeared under one folder on both builds. Selecting a sidebar folder in the graph hid an out-of-folder node that the graph search had found.
Compact list and transcript width PASS On both builds a sample row went from about 55 px to 32 px, and the width changed from Full to 46 rem and survived reload.
Side-by-side questions and letters PASS Both builds placed the same tall question in columns at 1720 px and stacked it at 840 px. Single-select options had A/B labels.
Agent prompt editor PASS The same 6,196-character default was readable on both builds. A saved, active override survived reload on both.
Model catalog refresh PASS with mock Settings issued the refresh and displayed the same no-provider result with the clean configuration. The PR's running server then imported a model from a mocked provider feed and used it in a real session.
Plan label smoke Shared failure Local PR and upstream each ran 79 checks and failed the same JetBrains Mono 11 px hard-title case. The Korean label measured 145.2 px in a 167 px box with 16 px padding per side. PR Linux CI reported a pass. Local evidence is in both plan-label result files.
Drawing Pad and plugins PASS Enabling the core plugin, drawing a stroke, and undoing it worked on PR, main, and upstream. The TeX check also exercised the core plugin settings.
Attached PDF crop PASS The PR accepted a PDF through the browser file chooser. The mock model dispatched visual, cropped page 2, annotated the 248 × 186 px image, and produced a visible artifact with job status done. Upstream produced the matching artifact using its local-file attachment path.
TeX code block PASS With Rich code blocks and Technical diagrams on, both builds displayed an undefined-control-sequence diagnostic and the original bad line.
Folder Delete PASS The PR left the viewed session, Back stayed outside it, and the claimed upload count fell from 1 to 0. Back reopened the deleted session on upstream.
Desktop updates and server list PASS for local paths driven Packaged PR and main matched for the local Settings button, download pill, hover notes, failed-download toast and Switch server picker. The real Check for Updates menu handler supplied the same Download/Later dialog for the fake update, with the expected installed version. The dialog arguments were captured through the main-process inspector.
Startup announcements PASS The packaged PR showed no announcement or announcement preload methods on startup.
Sign-in and pairing PASS In clean browser contexts both builds accepted the one-time code and allowed a session read (200). Reusing the code returned 401 and left the browser signed out.
Phone protocol PASS for wire compatibility The same protocol-1 client paired, created, read, and streamed sessions on both builds. Token exchange returned 200 and reuse 400. The PR advertised question-option-order-v1; main did not advertise it.
Teaching and scripted probes PASS for behavior With the supplemental selector reading the option label, both reads were byte-for-byte correct, the answer reached the model, the transcript persisted, and deletion and list ordering matched main. Packaged Electron completed the teaching flow. Broken stream recovery, double submit, mouse and keyboard Retry, and clean API checks matched main.
Standard scripted plan FAIL The maintained script read ABlue or BBlue as the option label and timed out without choosing Blue. That left downstream observations empty and disturbed the first API snapshot. Unchanged API scripts on fresh instances matched. The letter-aware browser drive still failed the accessibility budget. Self-hosted tier A matched main. After a clean mobile dependency retry, 158 unit tests and five link checks passed.
Self-hosted update and rollback PASS via explicit CLI Original tier B stopped at the update being available. A separate run using lh update --now installed B, backed up A, rejected broken C, rolled back to A, and kept the session through each switch. The real service and install fingerprint matched before and after.
Anthropic threads PASS with mock The PR sent create, continue, create, continue across two turns per key. Main sent create, continue, continue, continue across the same rotation. Four replies persisted on each build. No raw synthetic keys appeared in the app logs.
Retired models PASS with mock The listed retired model went from rejected to selectable and ran at the feed price of $2 input and $5 output per million tokens. The unlisted retired ID stayed absent and was rejected. The focused pricing test retained its $1 per million input/output pair from the historical table.

Retries and limits

  • The maintained skill ran through its comparisons and reached mobile installation before the machine restarted. I ran its mobile check separately after moving aside the interrupted dependency install. The first retry had a zero-byte React Native source file, and the clean install fixed that failure.
  • The upstream packaged server has no /api/health. I used /api/models as the readiness check for that supplemental comparison. I ran upstream's plan-label script against its shipped standalone entry point with the same browser checks.
  • Temporary verification copies adjusted the teaching and probe selector to exclude the letter span. The original scripted output and the supplemental comparison are both retained.
  • The native older phone and device render were outside the run under the no-emulator instruction. The full paired HTTPS desktop flow, remote app/server Settings rows, native dialog presentation and keyboard entry, pinned update restart, and downloaded-success toasts remain unverified. Local desktop tests used a temporary feed and the packaged Linux directory build under Xvfb.
  • The plan label failure remains reproducible locally on both versions. The initial tier B run also left automatic download unverified. The explicit CLI path passed.
  • The test apps, browsers, feeds, and disposable services were stopped. Evidence is retained here.

One conflict, components/answered-card.tsx: main's #326 reads the
confidence through shownConfidence(); the sync keeps upstream's imports
(lettered options, question layout) and its centered 4ch percentage, now
showing main's value.

Verified: checks
…op label

- First signed-in visit 500 ("Cannot access 'R' before initialization"
  in SettingsDialogProvider). The merge added a runtime import cycle:
  the settings dialog's new prompt editor (agent-section, prompt-segment-
  dialog, prompt-text) reaches host-markdown and the chat, which reach the
  sidebar, which mounts the dialog. Through the plugin host's async
  modules, the production server bundle could render the provider before
  its module had initialized. Upstream 069a6a1 has the same edges but
  serves 200; main lacks the prompt editor.
  The settings dialog and the sidebar are now on no import cycle:
  useSettingsDialog lives in settings-dialog-context.ts (dictation, plugin
  views and the shortcuts import it there), SidebarToggle and useSidebar
  in sidebar-toggle.tsx (top-bar, home, new session), and timeAgo in
  time-ago.ts (extraction coverage). sidebar.tsx and settings-dialog.tsx
  re-export what they moved.
- The sidebar's root drop space had aria-label on a plain div, which ARIA
  prohibits (axe aria-prohibited-attr, serious; upstream has it too). It
  is now SidebarRootDrop, a pointer-only drop target with no name.

Verified: checks
@max-miller1204

Copy link
Copy Markdown
Owner Author

Verify fixes (a216139)

First, origin/main (#326, #330, #331) is merged in at 66842cc with a real merge. The one conflict, components/answered-card.tsx, keeps main's shownConfidence() with upstream's lettered options and its centered percentage.

1. First signed-in visit 500

  • Cause: a runtime import cycle the merge added.
    • Settings' new prompt editor (agent-section → prompt-segment-dialog → prompt-text → host-markdown) reaches the chat. The chat reaches the sidebar, which mounts Settings.
    • Reading the failing chunk ([root-of-the-server]__0jp8yy560h7pz._.js) showed the cycle: SettingsDialogProvider reads R (newWriteOrder), which sits after the module's await on its async imports (the plugin host). The cycle let the page render the provider first.
  • Upstream or merge: it comes from the merge.
    • Upstream 069a6a1 has the same prompt-editor edges, but its fresh production build returns 200 on the first /chat/new.
    • Main has the sidebar cycle but not the prompt editor.
  • Fix: small modules break the cycles:
    • useSettingsDialog moves to settings-dialog-context.ts, imported from there by dictation, plugin views and the shortcuts;
    • SidebarToggle and useSidebar move to sidebar-toggle.tsx, imported by top-bar, home and new session;
    • timeAgo moves to time-ago.ts, imported by extraction coverage.
    • sidebar.tsx and settings-dialog.tsx re-export what moved.
  • Test: tests/import-cycles.test.ts checks that the settings dialog and the sidebar are on no runtime import cycle. It fails on 83ca438.
  • Production check: a fresh production build, next start on fresh data, then the first request is a signed-in GET /chat/new.
    • Before (the build at 66842cc): 500 then 200, with "Cannot access 'R' before initialization".
    • Now: 200 then 200 on three fresh servers. / as the first page also returns 200.

2. sidebar-root-drop label

  • Fix: the drop space is now SidebarRootDrop in sidebar-folders.tsx, a pointer-only drop target with no aria-label (ARIA prohibits naming a plain div).
  • Test: in tests/render-sidebar-folders.test.tsx. It fails on 83ca438 because the component isn't there yet; there the markup was inline in the sidebar.
  • axe 4.10.3 on the real page (the prove skill's pinned copy, fresh production server, /):
    • upstream 069a6a1: aria-prohibited-attr (serious) on the drop space, so the bug is upstream's too;
    • this head: no violation on it.
    • The four moderate landmark and heading findings are on both.
  • Not fixed here: the sidebar has no keyboard way to move a session out of folders, on either side. Left for later.

Checks

  • tsc is clean, and ESLint reports no errors (one existing warning).
  • 34 test files importing the changed components pass, each run alone under the memory cap.
  • The phone typecheck and node --test .github/scripts/*.test.cjs (52) passed after the main merge.

PR body: judgment calls 16 (import cycles) and 17 (the drop space) are added.

@max-miller1204

Copy link
Copy Markdown
Owner Author

prove-learnharness: BROKEN for a216139

Both fixes from the first report passed. The folder flow still has a keyboard blocker. Shift+F10 opens the session menu, but it has no move action and the root drop target cannot take focus.

Couldn't prove the maintained web plan as written because its answer selector includes the option letter. Packaged Electron was skipped because its recipe overlaps an app build and two server instances. Phone math ran through unit tests.

Observations

Flow Result Observation
First signed-in page PASS Old commit returned 500 on three fresh first visits to /chat/new, then 200 on retry. Head returned 200 on all three first visits. Three additional fresh / starts per revision also returned 200.
Sidebar axe PASS Zero violations on the main and head sidebars. The root drop target on head has no ARIA label.
Folder and Delete PASS Dragged the active session into a folder. Delete returned 200, removed the session and kept Back outside it.
Move out of folder by keyboard FAIL Shift+F10 exposed Rename, Export as Markdown, Delete and Extract. There was no move action, and the root drop target was outside the tab order.
Teaching, letters and confidence PASS Both exact file reads and the Blue answer reached the model. A/B and the saved 100% confidence rail were visible after reload on head.
Prompt editor PASS Read the 6,196-character default and saved an active override that survived reload.
Model refresh PASS with mock Settings added a model from a mocked provider feed and persisted it. The clean instance returned the no-provider message.
Maintained web plan BLOCKED The original scripts read ABlue as the label, never chose Blue and timed out. The letter-aware retry completed all 11 web steps and six probes. Fresh API checks matched main.
Phone math and launcher PASS 161 phone unit tests and five link checks passed. Launcher tier A matched main.
Verification receipt

Receipt for PR #322

Verdict: BROKEN
Checker: independent test sub-agent
Scope: db7d1e797875bfc05550a74c15e448f4f3c1fd31..a216139c59c21774f607d3d8cee3393bcb131a07 (clean checkout at scope calculation)
Changed files: 240, listed in changed-files.txt. The maintained skill's mapping is in scope.txt.
Surfaces driven: production standalone web, HTTP API, fake-model teaching, disposable launcher tier A, and phone unit tests.
Instances: three fresh production builds from 83ca438, a216139 and origin/main. Build logs were kept. Test servers ran one at a time with throwaway homes, sessions and data. The cold trial logs and JSON record each loopback port. The browser plan's health logs record versions and ports.
Follow-up run: ../20261122T013702Z-pr322-fresh-api-and-axe-be81f2/.

What the change touches and answer keys

  • The first signed-in page is existing behavior. The old failing commit is the before-and-after control (rung 1). I repeated the original standalone method with a fresh process and an issued session cookie for each first page. First report
  • Sidebar accessibility uses the maintained axe budget and origin/main. The new folder interactions use the earlier upstream parity observations and the repository's keyboard requirement. Folder Delete also uses the open-session deletion behavior in docs/specs/polish-first-load.md.
  • Teaching, confidence on an answered web card, HTTP routes, recovery and the launcher use origin/main (rung 1). Letters are new to the fork and use docs/specs/client-protocol.md and the first review's upstream observations.
  • Prompt editing and manual refresh are new to the fork. The expected behavior comes from the upstream comparison in the first review (rung 1). The provider feed is mocked. The app's own catalog tests supplement the browser drive.
  • Phone math uses the independent mobile assertions for Show math-only lines whole on iPhone and draw rules in the text color #318 (rung 3). The assertions cover clipping, line padding and rule color. The test brief called for unit tests.

Steps and break-it probes

Evidence Result Observation
cold-83ca438/result.json, cold-a216139/result.json PASS On 83ca438, three first signed-in GETs to /chat/new were 500, with Cannot access 'R' before initialization. All second GETs were 200. On a216139, all three first GETs and retries were 200 and the error was absent. Three separate servers per revision started with / and returned 200 on first request. All 12 trials confirmed a signed API read was 200 and the unsigned read was 401.
../20261122T013702Z-pr322-fresh-api-and-axe-be81f2/{base,head}/sidebar-axe/result.json PASS Axe 4.10.3 found zero violations in either sidebar. On a216139 the root drop element exists and has no ARIA label. Full-page checks on the new, pending and reloaded pages found zero serious or critical violations.
head/supplemental/result.json and ../20261122T013702Z-pr322-fresh-api-and-axe-be81f2/head/folder-keyboard/result.json PASS Created a folder, dragged the active teaching session into it, confirmed Delete with Enter and got 200. The app landed on / and Back went to /chat/new. The deleted session API returned 404 and its file was gone.
../20261122T013702Z-pr322-fresh-api-and-axe-be81f2/head/folder-keyboard/result.json and folder-session-context-menu.png in the same folder FAIL After placing a session in a folder, Shift+F10 opened its menu. The options were Rename, Export as Markdown, Delete and Extract. There was no move action, and the root drop target had tabIndex = -1. The source handles moving via drag and drop. This fails the repository's keyboard requirement for the new folder flow.
{base,head}/supplemental/result.json and head/supplemental/answered-after-reload.png PASS Both reads reached the model byte for byte (92 and 109 bytes). Blue reached the model and its reply persisted. The 100% confidence rail survived reload on main and head. The pending and answered cards on head each showed A and B.
../20261122T013702Z-pr322-fresh-api-and-axe-be81f2/head/prompt-retry/result.json PASS Viewed the rendered default, switched to Markdown and read 6,196 characters. Saved and activated a synthetic override. After reload, the row offered Edit override and the saved text matched exactly.
head/supplemental/result.json and model-refresh-mock.json PASS Settings showed the no-provider response on the clean instance. On a separate instance with a synthetic provider and mocked feed, the same button returned 200 and showed that the catalog was updated. The model went from absent to present in the picker catalog and was written to the snapshot.
compare-web-teach.md, compare-probes.md, compare-api-check.md BLOCKED in maintained plan Main completed the unchanged scripts. Head presented labels such as ABlue. The scripts compared each entire option's text to Blue and stalled before submitting the answer. The downstream API shape comparison then saw leftover sessions on head.
compare-web-letter-aware.md, compare-probes-letter-aware.md, ../20261122T013702Z-pr322-fresh-api-and-axe-be81f2/compare-fresh-api.md PASS for tested behavior Temporary copies removed only the letter from the text used to select and compare the option. All 11 teaching steps passed, including persistence, deletion and sidebar ordering. The only strict web comparison difference was the expected new folder data request, GET /api/graph/sources 200. All six probes passed, including double submit and both ways to Retry. Fresh API runs matched main on all 16 steps per side.
mobile-checks/unit-tests.log and mobile-checks/link-check.log PASS Under Node 22.23.5, 161 app tests passed, including #318's math-only line, padding and rule-color checks. Five link checks also passed.
compare-selfhost-a.md and focused-tests.log PASS Disposable launcher tier A matched main. Ten focused import-cycle, folder rendering and model-catalog tests passed.

Retries and limits

  • Ran the maintained plan's web, probes, API and launcher steps unchanged, with base and head started sequentially to respect the machine limit. The temporary letter-aware paths and the fresh API rerun preserve the original failures.
  • The first supplemental sidebar drive used a list test ID absent on main. The follow-up used the rendered sidebar's aside on both builds. The first prompt drive waited for a Markdown textarea while the dialog was showing Preview. The follow-up checked Preview first and explicitly chose Markdown.
  • Packaged Electron and desktop comparison were skipped. The maintained packaged recipe needs a standalone instance while it builds and launches another one. Mobile was verified through the requested tests. Device rendering and emulator checks were skipped.
  • Other flows from the first report were outside this focused browser re-check. It did not re-run plan label smoke, native desktop updates, wire pairing, live provider inference or launcher tier B.
  • Used available memory from free -m for the 3 GiB reserve. All sampled checks stayed above that reserve. Every test server, fake endpoint and browser was stopped. Temporary data, sign-in state and browser profiles were removed. Build caches, harness copies and sanitized evidence remain in the isolated temporary directory.

@max-miller1204
max-miller1204 merged commit 2f3520a into main Nov 22, 2026
19 checks passed
@max-miller1204
max-miller1204 deleted the sync/upstream-0.7.0 branch November 22, 2026 02:38
max-miller1204 added a commit that referenced this pull request Nov 22, 2026
One conflict, components/chat.tsx: upstream 0.7.0 fixed the same two
render-time writes onto sealed refs the same way (stable objects made
once with useState, `changed` forwarding through a ref to the latest
reader). Upstream's version is kept at both sites, so this branch now
adds only its server-render regression test (tests/chat-server-render).

Verified: checks
max-miller1204 added a commit that referenced this pull request Nov 22, 2026
…333) (#336)

Adds `tests/chat-server-render.test.tsx`, which renders Chat with `react-dom/server` in React's dev build for empty teach and practice sessions and the file-path smoke's teaching, probe and practice fixtures. It catches render-time property writes onto `useRef` objects, which React's dev server render seals. That bug made direct session-page loads return 500 in `next dev` (#333).

The upstream 0.7.0 sync (#322) had already fixed both write sites in `components/chat.tsx` the same way this PR did, so after merging main only the regression test remains.
- **Old code:** with either old write restored, all five session renders fail with "object is not extensible".
- **Merged code:** a direct `curl` of seeded teaching, probe and practice pages in `next dev` returns 200.

Closes #333.

Verified: checks, /code-review, codex (both reviews clean), live next dev check (200 on all three session pages)
max-miller1204 added a commit that referenced this pull request Nov 22, 2026
Brings #321 up to date with main (upstream 0.7.0 through #322, and the
#333 sealed-ref fix through #336), so a direct lesson load in next dev
answers 200 on this branch too. No conflicts; main changed none of the
files #321's rules live in (proxy.ts, auth.ts, auth-routes.ts,
auth-store.ts, pair-screen.tsx, browser-pair-handoff.ts, next.config.ts,
the login-pairing spec, the prove skill), and its one new API route is a
DELETE, which the cookie rule already covers.

Verified: checks
max-miller1204 added a commit that referenced this pull request Nov 22, 2026
…ss (#359)

/maintain-prove-it pass on prove-learnharness. Outcome: updated, every change proved live.

- Drifted step: since c3ff55f (upstream 0.7.0, #322) single-select options carry a letter badge, so web-teach.mjs and probes.mjs read "ABlue", never picked Blue, and timed out on head and base alike (receipts from #322, #349 and #302). New scripts/question-options.mjs reads each option's label without its badge, and the letter on its own. The options step still compares labels with ["Blue","Red"], the letters are diffed against base, and a missing option is its own failed step instead of a 60 s timeout.
- Working command: web.md names the folder toggle's exact selector, since a prefix match also hits its wrapper elements (from the #343 prove).
- SKILL.md "Could fool you" names the badge.

Proved live: run-plan.sh head against base passed compare-web, compare-probes, compare-electron and compare-desktop. The budgets (CLS, axe, console) run again, the packaged Electron window passes all 14 web-teach steps, and break-it probes (a wrong label, cards without badges, two-letter badges) behave. Skill files only: no app code, no answer keys.

Verified: prove (maintain pass, live)
max-miller1204 added a commit that referenced this pull request Nov 22, 2026
…es it (#378)

Every Nightly (self-hosted server) run since the upstream 0.7.0 merge (2f3520a, #322) failed at Desktop / Package (windows-x64), so no nightly release had shipped since 0.6.1-nightly.20261122.124. The installed Windows server answered 500 on every page with "Cannot find package '@shikijs/core' imported from ...\.next\node_modules\shiki-<hash>" (run 45019774528). The NSIS installer turns Next's .next/node_modules/shiki-<hash> link into a plain copy, and @shikijs/core is unreachable from that copy when it lives under node_modules/@streamdown/code/node_modules. #250 (aff528a) fixed this by moving the lock entries to the top level, but the upstream merge's lock regeneration nested them again.

shiki 3.23.0 is now a direct dependency, so npm keeps shiki and @shikijs/* at the top level, with unchanged versions and integrity. tests/shiki-lock-layout.test.ts fails if they're ever nested under @streamdown/code again, and its message gives the Windows installer reason.

Verified on Linux: npm ci, plugins:setup, build, build-server and the standalone server smoke pass, and the payload has shiki and @shikijs/* at the top level. The Windows installed-app smoke only runs in the Nightly workflow, so the next Nightly run is the real proof.

Verified: checks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants